<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>interview</title>
		<link href="../css/layui.css" rel="stylesheet"/>
		<script src="../js/layui.js"></script>
		<script src="../js/my.js"></script>
	</head>
	<body>
		
		<table id="interview" lay-filter="test2"></table>  
	
	</body>
	
	<script>
		$ = layui.$;
	
		let list = [];
	
		$.ajax({
			url: URL + "/seeker/interview/show",
			type: "post",
			// "token":localStorage.getItem("token")},
			headers: {
				"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NjA2MzgyMTgsInVzZXJuYW1lIjoiMTk5ODM0NTUxMTEifQ.XePUIfXs2liBMIsysgXpyTI8PVsOujSXY-IWbvU9Rt4"
			},
			success: function(result, status, xmlhttp) {
				list = result.data;
	
				layui.use('table', function() {
					var table = layui.table;
					table.on('tool(test2)', function(obj) {
						$.ajax({
							url: URL + "/seeker/interview/aor",
							type: "post",
							// headers: {"token":localStorage.getItem("token")},
							headers: {
								"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NjA2MzgyMTgsInVzZXJuYW1lIjoiMTk5ODM0NTUxMTEifQ.XePUIfXs2liBMIsysgXpyTI8PVsOujSXY-IWbvU9Rt4"
							},							
							data: {
								"aor": obj.event,
								"id": obj.data.id
							},
							success: function(result, status, xmlhttp) {
								alert(result.msg);
								location.reload();								
							}
						});
					});
					table.render({
						elem: '#interview',
						height: 'full-40',
						page: false, //开启分页
						cols: [
							[ //表头
								{field: 'id',title: '编号',sort: true,fixed: 'left',unresize: true,hide:true}, 
								{field: 'companyName',title: '公司名',width: 150,unresize: true},
								{field: 'sendTime',title: '发送时间',width: 180,unresize: true},
								{field: 'validTime',title: '失效时间',width: 180,unresize: true},
								{field: 'name',title: '面试名称',width: 100,unresize: true},
								{field: 'initiator',title: '发送人',width: 120,unresize: true},
								{field: 'interviewTime',title: '面试时间',width: 180,unresize: true},
								{field: 'address',title: '面试地点',width: 200,unresize: true},
								{field: 'state',width: 120,title: '状态',templet: function(d) {
									return ( d.state == 0 ? '<a class="layui-btn layui-btn-xs" lay-event="accept">接受</a><a class="layui-btn layui-btn-xs" lay-event="reject">拒绝</a>' : d.state == 1 ? "取消" : d.state == 2 ? "通过" : d.state == 3 ? "未通过" : d.state == 4 ? "已接受" : d.state == 5 ? "拒绝" : "error" )
									}
								}
							]
						],
						data: list,
						limit: list.length
					});
				});
			}
		});
	</script>
	
</html>